package priv.yiyuan.example.design.wrapper;

import java.util.ArrayList;
import java.util.List;

/**
 * 简历
 * <p>
 * 建造者模式-产品
 *
 * @author YiYuan
 * @data 2025/9/3
 * @apoNote
 */
public class Resume {

    private String basicInfo;

    private List<String> education;

    private List<String> workExperience;

    private List<String> projects;

    private List<String> skills;

    private List<String> awards;

    private List<String> publications;

    public Resume() {
        this.education = new ArrayList<>();
        this.workExperience = new ArrayList<>();
        this.projects = new ArrayList<>();
        this.skills = new ArrayList<>();
        this.awards = new ArrayList<>();
        this.publications = new ArrayList<>();
    }

    public void setBasicInfo(String basicInfo) {
        this.basicInfo = basicInfo;
    }

    public void addEducation(String edu) {
        this.education.add(edu);
    }

    public void addWorkExperience(String workExp) {
        this.workExperience.add(workExp);
    }

    public void addProject(String project) {
        this.projects.add(project);
    }

    public void addSkill(String skill) {
        this.skills.add(skill);
    }

    public void addAward(String award) {
        this.awards.add(award);
    }

    public void addPublication(String publication) {
        this.publications.add(publication);
    }

    public void display() {
        System.out.println("\n--- 简历内容 ---");
        if (basicInfo != null) {
            System.out.println("基本信息: " + basicInfo);
        }

        if (!education.isEmpty()) {
            System.out.println("教育背景: ");
            education.forEach(e -> System.out.println("  - " + e));
        }

        if (!workExperience.isEmpty()) {
            System.out.println("工作经验: ");
            workExperience.forEach(w -> System.out.println("  - " + w));
        }

        if (!projects.isEmpty()) {
            System.out.println("项目经验: ");
            projects.forEach(p -> System.out.println("  - " + p));
        }

        if (!skills.isEmpty()) {
            System.out.println("技能列表: ");
            skills.forEach(s -> System.out.println("  - " + s));
        }

        if (!awards.isEmpty()) {
            System.out.println("荣誉奖项: ");
            awards.forEach(a -> System.out.println("  - " + a));
        }

        if (!publications.isEmpty()) {
            System.out.println("发表论文: ");
            publications.forEach(pub -> System.out.println("  - " + pub));
        }

        System.out.println("--------------------");
    }

}
